{
  "name"    : "website",

  "include" :
  [
    {
      "path" : "${QOOXDOO_PATH}/tool/data/config/application.json",
      "block" : [
        "test-source",
        "test",
        "build",
        "source",
        "api-data",
        "api"
      ]
    },
    {
      "path" : "${QOOXDOO_PATH}/component/testrunner/portable.json",
      "as" : "testrunner-portable"
    }
  ],

  "let" :
  {
    "APPLICATION"  : "library",
    "QOOXDOO_PATH" : "../../..",
    "API_EXCLUDE"  : ["qx.test.*"],
    "LOCALES"      : [ "en" ],
    "CACHE"        : "${TMPDIR}/qx${QOOXDOO_VERSION}/cache",
    "BUILD_PATH"   : "script",
    "ROOT"         : ".",
    "TESTRUNNER_ROOT" : "${QOOXDOO_PATH}/component/testrunner",
    "TEST_SCRIPT_PATH"  : "./test/script",
    "API_SCRIPT_PATH" : "api/script",
    "Q_INCLUDES" : [
      "qx.module.*",
      "qxWeb"
    ],
    "API_INCLUDE" : "${Q_INCLUDES}"
  },

  "config-warnings" :
  {
    "job-shadowing" : [ "common", "testrunner-portable::build-script", "distclean", "clean" ],

    "environment" : [ "non-literal-keys" ]
  },

  "jobs" :
  {
    "website-libraries" :
    {
      "=library" :
      [
        {
           "manifest": "${QOOXDOO_PATH}/framework/Manifest.json"
        }
      ]
    },

    "website-common" :
    {
      "extend" : ["website-libraries"],

      "=include" : "${Q_INCLUDES}",

      "environment" :
      {
        "qx.version" : "${QOOXDOO_VERSION}",
        "qx.debug"   : false,
        "json" : true
      },
      "compile-options" :
      {
        "paths" :
        {
          "file-prefix" : "${QOOXDOO_PATH}/tool/data/generator/copyright.include.js"
        }
      }
    },

    "log-deps" :
    {
      "extend" : ["build-min"],

      "log" :
      {
        "dependencies" : {
          "dot" : {
            "root" : "qx.module.Template",
            "compiled-class-size" : false
            },
          "type"   : "using",
          "phase" : null,
          "include-transitive-load-deps" : true,
          "force-fresh-deps" : true,
          "format" : "dot"
        }
      }
    },

    "build" :
    {
      "extend" : ["website-common", "build-script"],

      "let" :
      {
        "OPTIMIZE" : ["variants"]
      },

      "compile-options" :
      {

        "code" : {
          "format" : true
        },

        "paths"  :
        {
          "file" : "${BUILD_PATH}/q-${QOOXDOO_VERSION}.js",
          "loader-template" : "${QOOXDOO_PATH}/tool/data/generator/website.loader.tmpl.js"
        }
      }
    },

    "build-min" :
    {
      "extend" : ["build"],

      "compile-options" :
      {
        "code" : {
          "=optimize" : ["basecalls", "comments", "privates", "strings", "variables", "variants", "statics", "whitespace"],
          "format" : false
        },
        "paths"  :
        {
          "file" : "${BUILD_PATH}/q-${QOOXDOO_VERSION}.min.js"
        }
      }
    },

    "source" :
    {
      "extend" : ["website-common", "source-script"],

      "let" :
      {
        "OPTIMIZE" : []
      },

      "compile-options" :
      {
        "code" : { "except" : [ "*" ] },

        "paths" :
        {
          "file" : "${BUILD_PATH}/q-source.js",
          "app-root" : "",
          "loader-template" : "${QOOXDOO_PATH}/tool/data/generator/website.loader.source.tmpl.js"

        }
      }
    },

    "test-source" :
    {
      "run" : [
        "test-source-script"
      ]
    },

    "test-source-script" :
    {
      "extend" : ["testrunner-portable::source-script"],

      "desc" : "generates a combined source version of q and the portable test runner",

      "let" :
      {
        "TESTRUNNER_ORIGIN" : "external"
      },

      "environment" :
      {
        "qx.debug" : true
      },

      "include" : "${Q_INCLUDES}",

      "compile-options" :
      {
        "paths" :
        {
          "file" : "${TEST_SCRIPT_PATH}/q-test-source.js"
        },
        "code" :
        {
          "except" : ["*"]
        }
      }
    },

    "build-min-test" :
    {
      "extend" : ["build-min"],

      "compile-options" :
      {
        "paths"  :
        {
          "=file" : "${TEST_SCRIPT_PATH}/q-${QOOXDOO_VERSION}.min.js"
        }
      }
    },

    "test" :
    {
      "let" :
      {
        "BUILD_SCRIPT_FILE" : "${TEST_SCRIPT_PATH}/testrunner-portable.js"
      },

      "run" : [
        "build-min-test",
        "testrunner-portable::build-script",
        "testrunner-portable::gen-css"
      ]
    },


    "testrunner-portable::build-script" :
    {
      "exclude" : "${Q_INCLUDES}",

      "config-warnings" :
      {
        "exclude" : "${Q_INCLUDES}"
      }
    },


    "api" :
    {
      "run" : ["build-api", "api-data"]
    },


    "build-api" :
    {
      "extend" : ["build-min"],

      "environment" :
      {
        "q.eventtypes" : "qx.module.event.Mouse,qx.module.event.Keyboard,qx.module.event.Native,qx.module.event.Orientation,qx.module.event.Touch"
      },
      "compile-options" :
      {
        "paths"  :
        {
          "file" : "${API_SCRIPT_PATH}/q-${QOOXDOO_VERSION}.min.js"
        }
      }
    },


    "api-data" : {
      "library" : [
        {"manifest" : "${QOOXDOO_PATH}/framework/Manifest.json"}
      ],

      "include" : "${API_INCLUDE}",

      "api" : {
        "path" : "${API_SCRIPT_PATH}"
      },
      "cache" :     {
        "compile"      : "${CACHE}",
        "invalidate-on-tool-change" : true
      }
    },

    "distclean" :
    {
      "desc"    : "remove local cache and generated .js files (source/build/build-min/test/test-source/api)",

      "cache"   : "${CACHE_KEY}",

      "=clean-files" :
      {
        "Deleting build/source" :
        [
          "${BUILD_PATH}"
        ],
        "Cleaning up tests" :
        [
          "${TEST_SCRIPT_PATH}"
        ],
        "Cleaning up API data" :
        [
          "${API_SCRIPT_PATH}"
        ]
      }
    },

    "clean" :
    {
      "desc"    : "remove local cache and generated .js files (source/build/build-min/test/api)",

      "cache"   : "${CACHE_KEY}",

      "=clean-files" :
      {
        "Cleaning up source" :
        [
          "${BUILD_PATH}/q-source*.js"
        ],
        "Cleaning up build" :
        [
          "${BUILD_PATH}/q-${QOOXDOO_VERSION}.js"
        ],
        "Cleaning up build-min" :
        [
          "${BUILD_PATH}/q-${QOOXDOO_VERSION}.min.js"
        ],
      }
    }
  }
}
